
<template>
  <div id="shopByDetail">
    <magic-header titleName="关于店铺" v-if="!isWxPublic"></magic-header>
    <div id="shop_aboutBox" v-html="introduce"></div>
    <div id="shop_qr">
      <img :src="qr" alt="">
      <p>店铺二维码</p>
    </div>
    <!-- 底部按钮 -->
    <div class="footer-flex-button">
		<div class="popup-button" :class="showCall ?  '' :'disable'">
            <i class="icon iconfont icon-dianhua" v-show="showCall"></i>
            <a class="tel" :href="phoneNumber" v-show="showCall && isWxPublic">服务热线</a>
            <a class="tel" v-show="showCall & !isWxPublic" @click="callPhone">服务热线</a>
            <a class="tel" v-show="!showCall">暂无服务热线</a>
        </div>
		<div class="popup-button" :class="shopList[0].latitude ?  '' :'disable'">
      <i class="icon iconfont icon-dingwei" v-if="shopList[0].latitude "></i><a v-if="shopList[0].latitude" class="lookToMap" @click="goMap">导航到店铺</a>
      <i class="icon iconfont icon-dingwei" v-if="!shopList[0].latitude"></i><a v-if="!shopList[0].latitude" class="lookToMap" @click="goMap">暂无导航</a>
      </div>
	</div>
    <!-- 底部按钮结束 -->
  </div>
</template>
<script>
import Vue from "vue";
import magicHeader from "components/magicHeader";
import shopAboutServices from "services/vfhz/shop_list";
export default {
  name: "shop_about",
  data() {
    return {
      shopName: "",
      phoneNumber: "123456",
      positionArr: [],
      cityId: "1111",
      tel: "",
      introduce: "",
      showCall: true,
      isWxPublic: false,
      shopList:[],
      qr:''
    };
  },
  created() {
    if (this.$.env === "wxPublic") {
      this.isWxPublic = true;
    }
    console.log(this.$.cityId);
    console.log(this.$.cityName);
    this.cityId = this.$.cityId;
    this.shopName = this.$route.query.shopName;
    this.getList();
  },
  methods: {
    //app中拨打电话
    callPhone() {
      this.$.push(
        "router_callOthers",
        {
          phone: this.phoneNumber
        },
        () => {
          console.log("调用成功");
        }
      );
    },
    //获取身边店数据
    getList() {
      shopAboutServices.bind(this)(
        {
          methodName: "ListUnionStoreByArea",
          areaId: this.cityId,
          searchValue: this.shopName
        },
        res => {
            console.log(res);
          this.positionArr = res.positionArr;
          this.positionArr[0].route = true;
          this.shopList = res.shopList;
          this.qr = this.addPath(res.shopList[0].qrCodePath)
          if (res.shopList[0].serviceMobile.length > 0) {
            this.phoneNumber = "tel:" + res.shopList[0].serviceMobile;
            this.showCall = true;
          } else {
            this.showCall = false;
          }
          this.introduce = res.shopList[0].introduce
          this.positionArr = [
              {
                longitude: res.shopList[0].longitude,
                latitude: res.shopList[0].latitude,
                name: res.shopList[0].shopName,
                route: true
              }
            ];
        },
        err => {
          this.$.toast(err);
        }
      );
    },
    goMap() {
      this.$router.push({
        name: "map",
        params: {
          mapParams: this.positionArr
        }
      });
    }
  },
  mounted() {},
  components: {
    magicHeader
  }
};
</script>
<style lang="scss">
#shopByDetail .footer-flex-button {
  background-color: #FFF;
  width: 100%;
  position: fixed;
  bottom: 0;
  height: 60px;
  text-align: center;
  padding: 10px;
}
#shopByDetail .popup-button {
  width: 46%;
  height: 44px;
  margin: 0 2%;
  float: left;
  color: #fff;
  font-size: 14px;
}
#shopByDetail .popup-button a {
  height: 44px;
  line-height: 44px;
  color: #fff;
}
#shopByDetail .popup-button i {
  display: inline;
  color: #fff;
  font-size: 20px;
}
#shopByDetail .popup-button:first-child {
  border-radius: 5px;
  background-color: #f88602;
}
#shopByDetail .popup-button:last-child {
  border-radius: 5px;
  background-color: #528bce;
}
#shopByDetail #shop_aboutBox {
  font-size: 14px;
}
#shopByDetail #shop_aboutBox img {
  width: 100% !important;
  clear: both;
  overflow: hidden;
  height: 100%;
}
#shopByDetail #shop_aboutBox div {
  overflow: hidden;
  height: 100%;
  text-align: left;
}

#shopByDetail #shop_aboutBox div.contact_font {
  padding: 0 5px;
  text-align: left;
}
#shopByDetail #shop_aboutBox p {
  padding: 0 5px;
  text-align: left;
}
#shopByDetail .disable{
  background-color: #eeeeee !important;
}
#shopByDetail #shop_qr{
  padding-bottom: 70px;
  img{
    display: block;
    width: 150px;
    height: 150px;
    margin: 0 auto
  }
  p{
    text-align: center;
    color: #F98700;
  }
}
</style>